package com.rf.richfitwheel.conf;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class  MybatisPlusConfig {

    @Bean
    public PaginationInterceptor mybatisplusInterceptor() {
        PaginationInterceptor interceptor = new PaginationInterceptor();
        //设置请求的页面大于最大页后操作，true调回到首页，false继续请求，默认false
//        interceptor.setOverflow(false);
        //设置最大单页限制数量，默认500条，-1不受限制
//        interceptor.setLimit(500);
        //开启count的 join优化，只针对 left join
        interceptor.setCountSqlParser(new JsqlParserCountOptimize(false));
        return interceptor;
    }


}
